﻿using com.guojin.core.io;
using com.guojin.core.io.message;

namespace com.guojin.mj.net.message.login
{
    //通知
    public class NoticeRet : Message
    {
        public static int TYPE = 7;
        public static int ID = 11;

        //是否需要重新启动游戏
        //0 横屏实时通知，1悬停错误提示


        public string key { get; set; }

        public int type { get; set; }

        public bool reboot { get; set; }

        public void decode(Input _in)
        {
            key = _in.readString();
            type = _in.readInt();
            reboot = _in.readBoolean();
        }

        public void encode(Output _out)
        {
            _out.writeString(key);
            _out.writeInt(type);
            _out.writeBoolean(reboot);
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return "Notice [key=" + key + ",type=" + type + ",reboot=" + reboot + ", ]";
        }

        public static NoticeRet create(string key, int type, bool reboot)
        {
            var noticeRet = new NoticeRet();
            noticeRet.key = key;
            noticeRet.type = type;
            noticeRet.reboot = reboot;
            return noticeRet;
        }
    }
}